class ScorePanel {
    constructor(maxLevel = 10, maxScore = 10) {
        this.score = 0;
        this.level = 1;
        this.maxLevel = maxLevel; //maxLevel 最大等级
        this.maxScore = maxScore; //maxScore 多少分升一级
        //分数
        this.scoreEle = document.querySelector('#score');
        //等级
        this.levelEle = document.querySelector('#level');
    }
    //加分
    addScore() {
        this.scoreEle.innerHTML = ++this.score + '';
        //升级
        if (this.score % this.maxLevel == 0) {
            this.levelUp();
        }
    }
    // 加等级
    levelUp() {
        //等级上限
        if (this.level < this.maxLevel) {
            this.levelEle.innerHTML = ++this.level + '';
        }
    }
}
export default ScorePanel;
